import React, { Component } from 'react'
import DatePicker from 'react-native-datepicker'
import {Text,View,Button,TouchableHighlight,Alert} from 'react-native';
import {Container,Content,Footer,Header,Title} from 'native-base';

export default class ShowDate extends Component {
  constructor(props){ 
    super(props);
    this.state = {date:new Date()};
  }
  func(){
  const date1='12-3-2013';
  const date2='6-6-2013';
  let time1=Date.parse(new Date(date1));
  let time2=Date.parse(new Date(date2));
  let day=(Math.abs(time2-time1))/1000/60/60/24;
  console.log(day);
  alert(day);
}
 

 
  
  render(){
    return (
      
      
      
      <View >
        
       <DatePicker
        style={{width: 200}}
        date={this.state.date}
        mode="date"
        placeholder="select date"
        format="YYYY-MM-DD"
        // minDate="2016-05-01"
        // maxDate="2016-06-01"
        confirmBtnText="Confirm"
        cancelBtnText="Cancel"
        iconSource={require('./cal.png')}
        customStyles={{
          dateIcon: {
            position: 'absolute',
            left: 0,
            top: 4,
            marginLeft: 0
          },
          dateInput: {
            marginLeft: 36
          }
          // ... You can check the source to find the other keys.
        }}
        onDateChange={(date) => {this.setState({date: date})}}
      />
      <TouchableHighlight onPress={this.func.bind(this)}>

       <Text>df</Text>
       </TouchableHighlight>
      </View>
    );
  }
}
